/******************************************************************************
 * * ui_log.h - ui log function declaration
 *
 * *(C) Copyright 2019 Asr International Ltd.
 * * All Rights Reserved
 * ******************************************************************************/
#ifndef UI_LOG_H
#define UI_LOG_H

#ifdef __cplusplus
extern "C" {
#endif

#include "ui_type.h"
#include "../../lvgl/hal/hal.h"
#include "ui_global.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>

#define UI_LOG_DEVICE             0
#define UI_LOG_MAX_SIZE           300
#define UI_LOG_ON_PC              1

#define UI_LOG_MODULE_NAME_LEN    12  // max size for [CALCULATOR]
#define UI_LOG_TIMESTAMP_LEN      10  // [00.00.00] hour.min.sec

typedef enum
{
    UI_LOG_LEVEL_TRACE_1 = 1,         // not important info, maybe for debug
    UI_LOG_LEVEL_TRACE_2,             // normal info, maybe for state change, some variable\ ....  
    UI_LOG_LEVEL_TRACE_3,             // important info, maybe for interface ....
    UI_LOG_LEVEL_WARNING,             // warning  
    UI_LOG_LEVEL_ERROR,               // error  
    UI_LOG_LEVEL_ASSERT               // assert, reset will follow
} UI_LOG_LEVEL;
#define UI_LOG_OUTPUT_LEVEL    UI_LOG_LEVEL_TRACE_1      // level bigger than this could be output
#define UI_LOG_FILTER_BITMAP   0xfff //(0b11111111111)
#define BITPOS(x)    (1 << x)

extern VOID UI_Log_Out(UI_SUB_MODULE_ID SubModuleId, UI_LOG_LEVEL LogLevel, INT8 *OutString, ...);

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /*UI_LOG_H*/
